home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / WANDR401.ZIP / sources / game.c < prev    next >
C/C++ Source or Header  |  1997-09-13  |  19KB  |  664 lines

  1. /*                game.c                                      */
  2.  
  3. /* Adapted for the DJGPP ALLEGRO game package                 */
  4. /* Seymour Shlien  24-Aug-97                                  */
  5.  
  6. /* This file contains the code for moving                     */
  7. /* the explorer on the board and interating                   */
  8. /* with the falling blocks, monsters, ...                     */
  9.  
  10. /* Besides the elimination of all the calls to curses/termcap  */
  11. /* and replacement with new functions in the display.c file,   */
  12. /* there were a few other changes made to the user interface.  */
  13. /* The #,~,?,q,m,n,<,> commands in the older version have been */
  14. /* replaced with Function key commands and the F6 menu. Though */
  15. /* R, S and cntl-R and cntl-W are still there, they are not    */
  16. /* supported commands. Hopefully, the player does not press    */
  17. /* these keys accidentally. cntl-L for loading the solution    */
  18. /* from a designated file if it exists is a new command        */
  19. /* described in the help.txt file. I didn't put it in the menu */
  20. /* because I don't want everybody to know about it.            */
  21.  
  22. /* Another significant change, is that the game either runs    */
  23. /* in record mode or playback. I got rid of all the checkpoint */
  24. /* stuff +,-,& in the record/playback mode. Everything is now  */
  25. /* automatic and transparent to the user who does not have to  */
  26. /* remember to turn the recorder on or off as in wandr330.zip  */
  27.  
  28.  
  29. #include "wand_head.h"
  30. #include <allegro.h>
  31. #include "samples.h"
  32.  
  33. /* I do not install_keyboard() but use the regular bios keyboard     */
  34. /* driver. Except for cntl keys, users do not press two keys at once.*/
  35. /* This makes debugging using Rhide1.3 a little easier.              */
  36.  
  37. #define UP_ARROW 328
  38. #define DOWN_ARROW 336
  39. #define LEFT_ARROW 331
  40. #define RIGHT_ARROW 333
  41.  
  42.  
  43. int playback_flag;      /* indicates whether F5 key is active */
  44. extern int audio_flag;  /* switches audio on or off           */
  45. extern int midi_flag;   /* switches midi on or off            */
  46.  
  47. extern int move_monsters();
  48. extern int check();
  49. extern void display();
  50. extern int fall();
  51. extern void map();
  52. extern void redraw_screen();
  53. extern struct mon_rec *make_monster();
  54.  
  55.  
  56. /* This array contains the representation of the game/puzzle.
  57.    It is read in from one of the level files and the array
  58.    maintains the state of the game.
  59. */
  60. extern char lscreen[NOOFROWS][ROWLEN+1];
  61.  
  62.  
  63. extern int debug_disp; /* switches between map and zoom mode        */
  64. extern char *edit_memory; /* memory for all key strokes, the amount */ 
  65. extern char *memory_end;  /* of space is set by EMSIZE in wand_hea.h */
  66. extern int pause2;  /* for slowing playback and animation        */
  67. extern int pause1;
  68. extern int gamelevel; /* The new level the user wants to go to   */
  69. extern int recording; /* Flag 1,2 for record and playback        */
  70. extern int signal_reload; /* from display.c indicates that level */
  71.                           /* reload is necessary.                */
  72.  
  73. struct mon_rec start_of_list = {0,0,0,0,0,NULL,NULL};
  74. struct mon_rec *last_of_list, *tail_of_list;
  75.  
  76. int nx,ny;  /* we need it global to allow for scrolling */
  77.  
  78. /* Actual game function - Calls fall() to move boulders and arrows
  79.     recursively.
  80.    Variable explanation :
  81.    x,y : where you are
  82.    nx,ny : where you're trying to move to
  83.    sx,sy : where the screen window on the playing area is
  84.    mx,my : where the monster is
  85.    tx,ty : teleport arrival
  86.    bx,by : baby monster position
  87.    nbx,nby : where it wants to be
  88.    lx,ly : the place you left when teleporting
  89.    nf : how many diamonds you've got so far
  90.    new_disp : the vector the baby monster is trying
  91. */
  92. extern int old_score; /* save old score in case of retry or killed */
  93.  
  94.  
  95.  
  96.  
  97. char *playscreen(num, score, maxmoves, keys)
  98. int  *num, maxmoves;
  99. long *score;
  100. char keys[10];
  101. {
  102.     int  x, y, deadyet = 0, sx = -1, sy = -1, tx = -1, ty = -1,
  103.      lx = 0, ly = 0, mx = -1, my = -1, 
  104.      diamonds = 0, nf = 0, tmpx, tmpy;
  105.     char (*frow)[ROWLEN+1] = lscreen,  buffer[25];
  106.     int ch;
  107.     struct mon_rec *monster;
  108.     static char howdead[25];
  109.     char *memory_ptr;
  110.     int ier;
  111.     int pathsize;
  112.     int signal_teleport;  /* indicates teleport occurred (for zoom mode) */
  113.     char comment[60];
  114.  
  115.     old_score = *score;
  116.     tail_of_list = &start_of_list;
  117.     memory_ptr = edit_memory;
  118.  
  119.  
  120.  
  121. /*   Scan the screen and find the explorer, monsters and count the*/
  122. /*   number of diamonds. Replace teleport arrival with blank.     */
  123.  
  124.     for (x = 0; x <= ROWLEN; x++)
  125.     for (y = 0; y < NOOFROWS; y++) {
  126.         if ((lscreen[y][x] == '*') || (lscreen[y][x] == '+'))
  127.         diamonds++;
  128.             if (lscreen[y][x] == 'A') {    /* note teleport arrival point & */
  129.                     /* replace with space */
  130.         tx = x;
  131.         ty = y;
  132.         lscreen[y][x] = ' ';
  133.         }
  134.         if (lscreen[y][x] == '@') {
  135.         sx = x;
  136.         sy = y;
  137.         }
  138.         if (lscreen[y][x] == 'M') {    /* Put megamonster in */
  139.         mx = x;
  140.         my = y;
  141.         }
  142.         if (lscreen[y][x] == 'S') {    /* link small monster to pointer chain */
  143.         if ((monster = make_monster(x,y)) == NULL) {
  144.             strcpy(howdead,"running out of memory");
  145.             return howdead;
  146.         }
  147.         if (!viable(x,y-1)) {    /* make sure its running in the */
  148.                     /* correct direction.. */
  149.             monster->mx = 1;
  150.             monster->my = 0;
  151.         } else if (!viable(x+1,y)) {
  152.             monster->mx = 0;
  153.             monster->my = 1;
  154.         } else if (!viable(x,y+1)) {
  155.             monster->mx = -1;
  156.             monster->my = 0;
  157.         } else if (!viable(x-1,y)) {
  158.             monster->mx = 0;
  159.             monster->my = -1;
  160.         }
  161.         }
  162.         if (lscreen[y][x] == '-')
  163.         lscreen[y][x] = ' ';
  164.     }
  165.     x = sx;
  166.     y = sy;
  167.     if ((x == -1) && (y == -1)) {    /* no start position in screen ? */
  168.     strcpy(howdead,"a screen design error");
  169.     return(howdead);
  170.     }
  171.  
  172.     if (maxmoves < 1) maxmoves = -1;
  173.  
  174.  
  175.  
  176.  
  177.  
  178.     update_game:    /*  restored game restarts here */
  179.  
  180.     redraw_screen(maxmoves,*num,*score,nf,diamonds,mx,sx,sy,frow);
  181.     nx = x;
  182.     ny = y;
  183.     signal_teleport =0;
  184.  
  185.  
  186. /*  THE GAME STARTS HERE.                         */
  187.  
  188.     while (deadyet == 0) {
  189.         refresh_screen();
  190.     switch (recording) {
  191.  
  192.     case 1:   /* Recording */
  193.         ch = getkey();
  194.         while (kbhit()) getch(); /* clear keyboard buffer */
  195.  
  196.             /* convert arrow keys to movement keys if necessary*/
  197.         if (ch == LEFT_ARROW) ch = keys[2];
  198.         else if (ch == RIGHT_ARROW) ch = keys[3];
  199.         else if (ch == UP_ARROW) ch= keys[0];
  200.         else if (ch == DOWN_ARROW) ch = keys[1];
  201.  
  202.         if((ch == keys[0]) || (ch == keys[1]) || (ch == keys[2]) ||
  203.                (ch == keys[3])) 
  204.             { *memory_ptr++ = ch;
  205.                   maxmoves--;
  206.               memory_end++;
  207.                  if(playback_flag == 1) 
  208.                    {                  
  209.                    playback_flag =0;
  210.                    make_control_bar();
  211.                    }
  212.                 }   
  213.             else if(ch>31 && ch<128 &&  ch != 'R' && ch != 'S')
  214.                {                    /* if not control or function key */
  215.                *memory_ptr++ = ' '; /* non movement keys represented */
  216.             memory_end++;       /* by space. monsters can move*/
  217.                if(playback_flag == 1) 
  218.                  {                  
  219.                  playback_flag =0;
  220.                  make_control_bar();
  221.                  }
  222.                }
  223.             if(maxmoves > 0) notify_maxmoves(maxmoves);
  224.         break;
  225.  
  226.  
  227.     case 2:     /* Playback */
  228.         if (bioskey(1))  /* check for interrupt */
  229.              {               /* and stop playback if*/
  230.              recording = 1;  /* present.            */
  231.              continue;
  232.              }
  233.  
  234.         ch = *memory_ptr;
  235.             memory_ptr++;
  236.         delay(pause2); /* slow it down */
  237.         if(ch != ' ') maxmoves--;
  238.         if (ch == '\0')
  239.         ch = ')';
  240.         break;
  241.     default:
  242.             alert_message("program error: recording not 1 or 2");
  243.  
  244.     }
  245.  
  246.  
  247.  
  248.     nx = x;
  249.     ny = y;
  250.  
  251. /************************************************************/
  252. /*             Execute movement keys                        */
  253. /************************************************************/
  254.  
  255.     if ((ch == keys[3]) && (x <(ROWLEN-1)))
  256.         nx++;
  257.     if ((ch == keys[2]) && (x > 0))
  258.         nx--;
  259.     if ((ch == keys[1]) && (y <(NOOFROWS-1)))
  260.         ny++;
  261.     if ((ch == keys[0]) && (y > 0))
  262.         ny--;
  263.  
  264.     if (ch == 315) {    /* F1. Help key */
  265.             show_help();
  266.         continue; /* don't move monsters */
  267.     }
  268.  
  269.  
  270.     if (ch == 316) {    /* F2. About window */
  271.             draw_about_window();
  272.         continue; /* don't move monsters */
  273.     }
  274.  
  275. /**************************************************************/
  276. /*              Quit,  Restart                                */
  277. /**************************************************************/
  278.  
  279.  
  280.     if (ch == 318) {       /* F4. restart same level */
  281.              if(memory_ptr != edit_memory) /* in case you press F4 twice */
  282.                 {
  283.                 playback_flag = 1;
  284.                 *memory_ptr = ')';
  285.                 }
  286.          *score = old_score;
  287.          sprintf(howdead,"~%c",*num);
  288.          return howdead;
  289.         }
  290.  
  291.     if (ch == 27) {       /* ESC. */
  292.         strcpy(howdead,"quitting the game");
  293.         return howdead;
  294.     }
  295.  
  296. /**************************************************************/
  297. /*                 Display Options                            */
  298. /**************************************************************/
  299.  
  300.  
  301.     if (ch == 317) {     /* F3    */
  302.         debug_disp = 1 - debug_disp;
  303.             if(debug_disp) clear_remnant();
  304.         continue;
  305.         }
  306.  
  307.  
  308. /**************************************************************/
  309. /*               Memory Functions                             */
  310. /**************************************************************/
  311.  
  312.  
  313.     if (ch == ')')
  314.      {
  315.      if (recording == 2)
  316.                {
  317.                recording = 1;
  318.                memory_ptr--;
  319.                memory_end = memory_ptr;
  320.                }
  321.       continue; /* don't move monsters if present */
  322.       }
  323.  
  324.     if (ch == 319)   /* F5  */
  325.         {
  326.         if (playback_flag)
  327.                {    /* playback memory */
  328.         recording = 2;
  329.         playback_flag =0;
  330.         make_control_bar();
  331.            }
  332.     continue;
  333.         }
  334.  
  335.  
  336.     if  (ch == 320)  /* F6 */
  337.       {
  338.       menu_interface();
  339.       if(signal_reload)
  340.         {
  341.     sprintf(howdead,"~%c",gamelevel);
  342.         if(midi_flag) load_and_play_midi();
  343.     return howdead;
  344.     }
  345.     continue;
  346.       }
  347.  
  348.  
  349.  
  350.  
  351.  
  352. /**************************************************************/
  353. /*                     Save, Restore options                  */
  354. /**************************************************************/
  355.  
  356. /*   Added save/restore game feature.  Gregory H. Margo */
  357.  
  358.     if (ch == 'S') {    /* save game */
  359.         extern struct save_vars zz;
  360.  
  361.         /* stuff away important local variables to be saved */
  362.         /* so the game state may be acurately restored    */
  363.         zz.z_x        = x;
  364.         zz.z_y        = y;
  365.         zz.z_sx        = sx;
  366.         zz.z_sy        = sy;
  367.         zz.z_tx        = tx;
  368.         zz.z_ty        = ty;
  369.         zz.z_mx        = mx;
  370.         zz.z_my        = my;
  371.         zz.z_diamonds    = diamonds;
  372.         zz.z_nf        = nf;
  373.  
  374.         save_game(*num, score, audio_flag, maxmoves);
  375.         /* NOTREACHED ... unless there's been an error. */
  376.     }
  377.  
  378.     if (ch == 'R') {    /* restore game */
  379.         extern struct save_vars zz;
  380.  
  381.         ier = restore_game(num, score, audio_flag, &maxmoves);
  382.  
  383.             if(ier == 0)
  384.             {
  385.         /* recover important local variables */
  386.         x        = zz.z_x;
  387.         y        = zz.z_y;
  388.         sx        = zz.z_sx;
  389.         sy        = zz.z_sy;
  390.         tx        = zz.z_tx;
  391.         ty        = zz.z_ty;
  392.         mx        = zz.z_mx;
  393.         my        = zz.z_my;
  394.         diamonds    = zz.z_diamonds;
  395.         nf        = zz.z_nf;
  396.             }
  397.  
  398.         goto update_game;    /* the dreaded goto    */
  399.     }
  400.  
  401.  
  402.     if (ch == 12)     /* ctrl l -- read solution data */
  403.             {
  404.             if(memory_ptr != edit_memory)
  405.                {
  406.                alert_message("First press F4 to restart");
  407.                continue;
  408.                }
  409.            
  410.         ier = edit_restore(*num);
  411.              if(ier >= 0) playback_flag=1;
  412.              make_control_bar();
  413.              continue;  /* do not move monsters if present */
  414.              }
  415.  
  416.     if (ch == 18)     /* ctrl r -- read memory data */
  417.         {ier = edit_restore(0);
  418.              if(ier >= 0) playback_flag=1;
  419.              make_control_bar();
  420.              continue;  /* do not move monsters if present */
  421.              }
  422.  
  423.     if (ch == 23)     /* ctrl w -- write memory data */
  424.         {edit_save(-1);
  425.              continue;
  426.             }
  427.  
  428.     if (lscreen[ny][nx] == 'C') {
  429.         lscreen[ny][nx] = ':';
  430.         *score+=4;
  431.             if(audio_flag) play_audio_sample(GET_CAPSULE_SND);
  432.         if (maxmoves != -1)
  433.         maxmoves+=250;
  434.     }
  435.  
  436.  
  437. /**************************************************************/
  438. /*            G A M E     A C T I O N S                       */
  439. /**************************************************************/
  440.  
  441.  
  442.  
  443.     switch (lscreen[ny][nx]) {
  444.     case '@': break;
  445.     case '*': *score+=9;
  446.         nf++;
  447.             notify_diamonds(nf,diamonds);
  448.             if(audio_flag) play_audio_sample(GET_DIAMOND_SND);
  449.     case ':': *score+=1;
  450.             notify_score(*score);
  451.     case ' ':
  452.         lscreen[y][x] = ' ';
  453.         lscreen[ny][nx] = '@';
  454.         draw_object(y,x,' ');
  455.             draw_object(ny,nx,'@');
  456.         deadyet += check(&mx,&my,x,y,nx-x,ny-y,sx,sy,howdead);
  457.         y = ny;
  458.         x = nx;
  459.         break;
  460.     case 'O':
  461.         if ((nx == 0) || (nx == ROWLEN)) break;
  462.         if (lscreen[y][nx*2-x] == 'M') {
  463.         lscreen[y][nx*2-x] = ' ';
  464.         mx = my = -1;
  465.         *score+=100;
  466.                 notify_score(*score);
  467.         }
  468.         if (lscreen[y][nx*2-x] == ' ') {
  469.         lscreen[y][nx*2-x] = 'O';
  470.         lscreen[y][x] = ' ';
  471.         lscreen[ny][nx] = '@';
  472.             draw_object(y,x,' ');
  473.                 draw_object(ny,nx,'@');
  474.                 draw_object(y,nx*2-x,'O');
  475.         deadyet += fall(&mx,&my,nx*2-x,y+1,sx,sy,howdead);
  476.         deadyet += fall(&mx,&my,x*2-nx,y,sx,sy,howdead);
  477.         deadyet += fall(&mx,&my,x,y,sx,sy,howdead);
  478.         deadyet += fall(&mx,&my,x,y-1,sx,sy,howdead);
  479.         deadyet += fall(&mx,&my,x,y+1,sx,sy,howdead);
  480.         y = ny;
  481.         x = nx;
  482.         }
  483.         break;
  484.     case '^':
  485.         if ((nx == 0) || (nx == ROWLEN)) break;
  486.         if (lscreen[y][nx*2-x] == ' ') {
  487.         lscreen[y][nx*2-x] = '^';
  488.         lscreen[y][x] = ' ';
  489.         lscreen[ny][nx] = '@';
  490.             draw_object(y,x,' ');
  491.         draw_object(ny,nx,'@');
  492.                 draw_object(y,nx*2-x,'^');
  493.         deadyet += fall(&mx,&my,nx*2-x,y-1,sx,sy,howdead);
  494.         deadyet += fall(&mx,&my,x*2-nx,y,sx,sy,howdead);
  495.         deadyet += fall(&mx,&my,x,y,sx,sy,howdead);
  496.         deadyet += fall(&mx,&my,x,y+1,sx,sy,howdead);
  497.         deadyet += fall(&mx,&my,x,y-1,sx,sy,howdead);
  498.         y = ny;
  499.         x = nx;
  500.         }
  501.         break;
  502.     case '<':
  503.     case '>':
  504.         if ((ny == 0) || (ny == NOOFROWS)) break;
  505.         if (lscreen[ny*2-y][x] == 'M') {
  506.         lscreen[ny*2-y][x] = ' ';
  507.         mx = my = -1;
  508.         *score+=100;
  509.                 notify_score(*score);
  510.         }
  511.         if (lscreen[ny*2-y][x] == ' ') {
  512.         lscreen[ny*2-y][x] = lscreen[ny][nx];
  513.         lscreen[y][x] = ' ';
  514.         lscreen[ny][nx] = '@';
  515.         draw_object(y,x,' ');
  516.         draw_object(ny,nx,'@');
  517.         draw_object(ny*2-y,x,lscreen[ny*2-y][x]);
  518.         deadyet += fall(&mx,&my,x,y,sx,sy,howdead);
  519.         deadyet += fall(&mx,&my,x-1,(ny>y)?y:(y-1)
  520.                           ,sx,sy,howdead);
  521.         deadyet += fall(&mx,&my,x+1,(ny>y)?y:(y-1)
  522.                           ,sx,sy,howdead);
  523.         deadyet += fall(&mx,&my,x-1,ny*2-y,sx,sy,howdead);
  524.         deadyet += fall(&mx,&my,x+1,ny*2-y,sx,sy,howdead);
  525.         y = ny;
  526.         x = nx;
  527.         }
  528.         break;
  529.     case '~':
  530.         if (((2*nx-x) < 0) || ((ny*2-y) > NOOFROWS) || ((ny*2-y) < 0) ||
  531.         ((2*nx-x) > ROWLEN)) break;
  532.         if (lscreen[ny*2-y][nx*2 -x] == 'M') {
  533.         lscreen[ny*2-y][nx*2-x] = ' ';
  534.         mx = my = -1;
  535.         *score+=100;
  536.                 notify_score(*score);
  537.         }
  538.         if (lscreen[ny*2-y][nx*2-x] == ' ') {
  539.         lscreen[ny*2-y][nx*2-x] = '~';
  540.         lscreen[y][x] = ' ';
  541.         lscreen[ny][nx] = '@';
  542.             draw_object(y,x,' ');
  543.         draw_object(ny,nx,'@');
  544.         draw_object(ny*2-y,nx*2-x,'~');
  545.         deadyet += check(&mx,&my,x,y,nx-x,ny-y,sx,sy,howdead);
  546.         y = ny; x = nx;
  547.         }
  548.         break;
  549.     case '!':
  550.         strcpy(howdead,"an exploding landmine");
  551.         deadyet = 1;
  552.         draw_object(y,x,' ');
  553.         draw_object(ny,nx,'@');
  554.             if(audio_flag) play_audio_sample(KILLED_BY_MINE_SND);
  555.         break;
  556.     case 'X':
  557.         if (nf == diamonds) {
  558.         *score+=250;
  559.                 recording=1;
  560.                 playback_flag=0;
  561.                 pathsize = size_of_path_file(*num);
  562.                 if(recording == 1)
  563.                   {
  564.                   memory_ptr -= 2;
  565.                   *memory_ptr = ')';
  566.                   if(audio_flag) play_audio_sample(LEVEL_DONE_SND);
  567.                   if(pathsize == 0)
  568.                    {
  569.                    edit_save(*num);
  570.                    alert_congratulations(0);
  571.                    }
  572.                   else if ((pathsize - 5) > (memory_ptr - edit_memory))
  573.                    {
  574.                    edit_save(*num);
  575.                    alert_congratulations(1);
  576.                    }
  577.                   }
  578.         gamelevel = (*num) + 1;
  579.         if(midi_flag) load_and_play_midi();
  580.         return NULL;
  581.         }
  582.         break;
  583.     case 'T':
  584.         if (tx > -1) {
  585.         lscreen[ny][nx] = ' ';
  586.         lscreen[y][x] = ' ';
  587.         lx = x;
  588.         ly = y;
  589.         y = ty;
  590.         x = tx;
  591.         lscreen[y][x] = '@';
  592.         sx = x;
  593.         sy = y;
  594.         *score += 20;
  595.                 notify_score(*score);
  596.              map(frow);
  597.                 signal_teleport =1;
  598.         deadyet += fall(&mx,&my,nx,ny,sx,sy,howdead);
  599.         if (deadyet == 0)
  600.             deadyet = fall(&mx,&my,lx,ly,sx,sy,howdead);
  601.         if (deadyet == 0)
  602.             deadyet = fall(&mx,&my,lx+1,ly-1,sx,sy,howdead);
  603.         if (deadyet == 0)
  604.             deadyet = fall(&mx,&my,lx+1,ly+1,sx,sy,howdead);
  605.         if (deadyet == 0)
  606.             deadyet = fall(&mx,&my,lx-1,ly+1,sx,sy,howdead);
  607.         if (deadyet == 0)
  608.             deadyet = fall(&mx,&my,lx-1,ly-1,sx,sy,howdead);
  609.         } else {
  610.         lscreen[ny][nx] = ' ';
  611.         printf("Teleport out of order");
  612.         }
  613.         break;
  614.     case 'M':
  615.         strcpy(howdead,"a hungry monster");
  616.         deadyet = 1;
  617.          draw_object(y,x,' ');
  618.             if(audio_flag) play_audio_sample(KILLED_BY_M_SND);
  619.         break;
  620.     case 'S':
  621.         strcpy(howdead,"walking into a monster");
  622.          deadyet = 1;
  623.           draw_object(y,x,' ');
  624.              if(audio_flag) play_audio_sample(KILLED_BY_S_SND);
  625.         break;
  626.     default:
  627.         break;
  628.     }
  629.  
  630.  
  631.  
  632.  
  633.  
  634.     if ((y == ny) && (x == nx) && (maxmoves > 0)) 
  635.            notify_maxmoves(maxmoves);
  636.     
  637.     if (maxmoves == 0) {
  638.         strcpy(howdead,"running out of moves");
  639.             if(audio_flag) play_audio_sample(NO_MOVES_SND);
  640.         deadyet = 1;
  641.     }
  642.  
  643.         if (signal_teleport)
  644.            {
  645.            /* we have to update nx,ny here so the zoom screen */
  646.            /* scrolls the right location.                     */
  647.            nx = x;
  648.            ny = y;
  649.            draw_object(ny,nx,'@');  /* initiates the scrolling */
  650.            if(audio_flag) play_audio_sample(TELEPORT_SND);
  651.            signal_teleport = 0;
  652.            }
  653.  
  654.     deadyet += move_monsters(&mx,&my,score,howdead,sx,sy
  655.          ,nf,x,y,diamonds);
  656.  
  657.  
  658.     }
  659.     if(recording==1)
  660.     *(memory_ptr-2) = ')'; /* step back to avoid death */
  661.     playback_flag=1;
  662.     return(howdead);
  663. }
  664.